var e = require("../../../@babel/runtime/helpers/typeof"), t = function() {
    function t(e, t) {
        return null != t && e instanceof t;
    }
    var r, n, o;
    try {
        r = Map;
    } catch (e) {
        e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
        r = function() {};
    }
    try {
        n = Set;
    } catch (e) {
        e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
        n = function() {};
    }
    try {
        o = Promise;
    } catch (e) {
        e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
        o = function() {};
    }
    function i(c, u, a, l, s) {
        "object" == e(u) && (a = u.depth, l = u.prototype, s = u.includeNonEnumerable, u = u.circular);
        var p = [], b = [], y = "undefined" != typeof Buffer;
        return void 0 === u && (u = !0), void 0 === a && (a = 1 / 0), function c(a, g) {
            if (null === a) return null;
            if (0 === g) return a;
            var j, O;
            if ("object" != e(a)) return a;
            if (t(a, r)) j = new r(); else if (t(a, n)) j = new n(); else if (t(a, o)) j = new o(function(e, t) {
                a.then(function(t) {
                    e(c(t, g - 1));
                }, function(e) {
                    t(c(e, g - 1));
                });
            }); else if (i.__isArray(a)) j = []; else if (i.__isRegExp(a)) j = new RegExp(a.source, f(a)), 
            a.lastIndex && (j.lastIndex = a.lastIndex); else if (i.__isDate(a)) j = new Date(a.getTime()); else {
                if (y && Buffer.isBuffer(a)) return Buffer.from ? j = Buffer.from(a) : (j = new Buffer(a.length), 
                a.copy(j)), j;
                t(a, Error) ? j = Object.create(a) : void 0 === l ? (O = Object.getPrototypeOf(a), 
                j = Object.create(O)) : (j = Object.create(l), O = l);
            }
            if (u) {
                var d = p.indexOf(a);
                if (-1 != d) return b[d];
                p.push(a), b.push(j);
            }
            for (var v in t(a, r) && a.forEach(function(e, t) {
                var r = c(t, g - 1), n = c(e, g - 1);
                j.set(r, n);
            }), t(a, n) && a.forEach(function(e) {
                var t = c(e, g - 1);
                j.add(t);
            }), a) {
                Object.getOwnPropertyDescriptor(a, v) && (j[v] = c(a[v], g - 1));
                try {
                    if ("undefined" === Object.getOwnPropertyDescriptor(a, v).set) continue;
                    j[v] = c(a[v], g - 1);
                } catch (e) {
                    e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                    if (e instanceof TypeError) continue;
                    if (e instanceof ReferenceError) continue;
                }
            }
            if (Object.getOwnPropertySymbols) {
                var _ = Object.getOwnPropertySymbols(a);
                for (v = 0; v < _.length; v++) {
                    var h = _[v];
                    (!(m = Object.getOwnPropertyDescriptor(a, h)) || m.enumerable || s) && (j[h] = c(a[h], g - 1), 
                    Object.defineProperty(j, h, m));
                }
            }
            if (s) {
                var w = Object.getOwnPropertyNames(a);
                for (v = 0; v < w.length; v++) {
                    var m, P = w[v];
                    (m = Object.getOwnPropertyDescriptor(a, P)) && m.enumerable || (j[P] = c(a[P], g - 1), 
                    Object.defineProperty(j, P, m));
                }
            }
            return j;
        }(c, a);
    }
    function c(e) {
        return Object.prototype.toString.call(e);
    }
    function f(e) {
        var t = "";
        return e.global && (t += "g"), e.ignoreCase && (t += "i"), e.multiline && (t += "m"), 
        t;
    }
    return i.clonePrototype = function(e) {
        if (null === e) return null;
        var t = function() {};
        return t.prototype = e, new t();
    }, i.__objToStr = c, i.__isDate = function(t) {
        return "object" == e(t) && "[object Date]" === c(t);
    }, i.__isArray = function(t) {
        return "object" == e(t) && "[object Array]" === c(t);
    }, i.__isRegExp = function(t) {
        return "object" == e(t) && "[object RegExp]" === c(t);
    }, i.__getRegExpFlags = f, i;
}();

exports.clone = t;